<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	template="/layout/page/sample/left-right-template.xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:a4j="http://www.sinosoft.com.cn/a4j"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">

	<ui:param name="compId" value="#{commonContentViewBean.id}" />
	<ui:param name="treeViewBean"
		value="#{commonContentViewBean.allView[0]}" />
	<ui:param name="rightViewBean"
		value="#{commonContentViewBean.allView[1]}" />
	<ui:define name="compLeft">
		<h:form id="#{compId}_form">			
			<ui:decorate
				template="/layout/iteration/tree/sino-tree-single-template.xhtml">
				<ui:param name="compViewBean" value="#{treeViewBean}" />
				<ui:param name="compId" value="#{commonContentViewBean.id}_tree" />
				<ui:param name="compSelectedNodeUpdate"
					value="main-tabSet:#{commonContentViewBean.id}_right_form" />
			</ui:decorate>
		</h:form>
	</ui:define>

	<ui:define name="compRight">
		<h:form style="margin:0;" id="#{compId}_right_form">
			
			<p:toolbar>
				<p:toolbarGroup align="left" styleClass="portal-search-form-toolbar-only">
					<h:outputText value="数据字典管理" />
				</p:toolbarGroup>
				<p:toolbarGroup align="right">
					<p:commandButton 
						oncomplete="SinoPortal.View.createWin('dataDictionaryTable-scene','dataDictionaryTable-add','#{compId}',{type:'createdir',displayName:'新建目录'});"
						title="新建空目录" image="ui-icon-disk" value="新建空目录">
					</p:commandButton>
					<p:commandButton 
						oncomplete="SinoPortal.View.createWin('dataDictionaryTable-scene','dataDictionaryTable-addfile','#{compId}',{type:'createfile',displayName:'新建代码文件'});"
						title="新建代码文件" image="ui-icon-disk" value="新建代码文件">
					</p:commandButton>
					<p:commandButton 
						oncomplete="SinoPortal.View.createWin('dataDictionaryTable-scene','dataDictionaryTable-addAndEdit','#{compId}',{type:'create',displayName:'新建代码'});"
						title="添加代码" image="ui-icon-disk" value="添加代码">
					</p:commandButton>
					<p:commandButton 
						oncomplete="SinoPortal.View.createWin('dataDictionaryTable-scene','dataDictionaryTable-addAndEdit','#{compId}',{type:'addsub',displayName:'新建子代码'});"
						title="添加子代码" image="ui-icon-disk" value="添加子代码">
					</p:commandButton>
					<p:commandButton
						oncomplete="SinoPortal.View.createWin('dataDictionaryTable-scene','dataDictionaryTable-addAndEdit','#{compId}',{type:'update',displayName:'修改代码'});"
						title="修改代码" image="ui-icon-disk" value="修改代码">
					</p:commandButton>
					
					<p:commandButton actionListener="#{codeSetManageAction.delAction}"
						onstart="if(confirm('确认要删除吗？')){return true;}else{return false;}"
						update="#{compId}_right_form"
						title="删除代码" image="ui-icon-disk" value="删除代码">
						<h:inputHidden value="#{rightViewBean.id}" />
					</p:commandButton>
				</p:toolbarGroup>
			</p:toolbar>
			
			<p:treeTable id="#{rightViewBean.id}_codetree"
				value="#{rightViewBean.root}" selectionMode="single"
				selectionColumnLabel="选择"
				selection="#{rightViewBean.selectedCodeNode}" var="code"
				>
				<p:column>
					<f:facet name="header">
						代码名称
					</f:facet>
					<h:outputText value="#{code.name}" />
				</p:column>
				<p:column>
					<f:facet name="header">
						代码值
					</f:facet>
					<h:outputText value="#{code.value}" />
				</p:column>
			</p:treeTable>
		</h:form>
	</ui:define>
</ui:composition>
